import { request } from "../request";

/**
 * 获取AI资源详情接口返回结构
 */
export interface GetResourceByIdRes {
    code: number;
    message: string;
    data: {
        resourceId: number;
        chatId: number;
        userId: number;
        ossUrl: string;
        type: string;
        createdAt: Record<string, unknown>;
    };
    timestamp: Record<string, unknown>;
}

/**
 * 获取AI资源详情
 * @param id 资源ID
 * @returns AI资源详情
 */
export const getResourceByIdAPI = async (id: number): Promise<GetResourceByIdRes> => {
    const token = localStorage.getItem("token");
    return request(`/api/ai-resources/${id}`, {
        method: "get",
        headers: {
            Authorization: `Bearer ${token}`
        }
    });
};